package com.xcdh.trading.task;

import cn.hutool.core.date.DateUtil;
import com.xcdh.trading.service.AStockService;
import com.xcdh.trading.service.DayTransactionDataService;
import com.xcdh.trading.service.StockInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Date;

@Component
public class DayTransactionTask {

    @Autowired
    private AStockService aStockService;

    @Autowired
    private DayTransactionDataService dayTransactionDataService ;
    @Autowired
    private StockInfoService stockInfoService ;


    @Scheduled(cron = "0 0 16 * * MON-FRI")
    public void performTask() {
        String date = DateUtil.format(new Date(), "yyyyMMdd");
        aStockService.downLoadAStock();
        dayTransactionDataService.syncTransactionData(date);
        dayTransactionDataService.countTransactionData(date);
    }

}
